﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:Tutorial="clr-namespace:Tutorial"
    x:Class="Tutorial.Window1"
    Title="Window1" Height="487" Width="675" xmlns:WpfHero="clr-namespace:WpfHero;assembly=WHEngine">
	<Window.Resources>
		<Tutorial:BooleanToBoldConverter x:Key="BooleanToBoldConverter"/>
		<SolidColorBrush x:Key="ListBorder" Color="#828790"/>
		<Style x:Key="SongBrowserStyle" TargetType="{x:Type ListBox}">
			<Style.Resources>
				<Storyboard x:Key="Storyboard1">
					<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
						<SplineColorKeyFrame KeyTime="00:00:02" Value="#FFDF8421"/>
					</ColorAnimationUsingKeyFrames>
				</Storyboard>
				<Storyboard x:Key="Storyboard_Copy1">
					<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
						<SplineColorKeyFrame KeyTime="00:00:02" Value="#FFFFFFFF"/>
					</ColorAnimationUsingKeyFrames>
				</Storyboard>
			</Style.Resources>
			<Setter Property="Background" Value="#FFFFFFFF"/>
			<Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBox}">
						<Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
							<ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
								<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
							</ScrollViewer>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
							</Trigger>
							<Trigger Property="IsGrouping" Value="true">
								<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsMouseOver" Value="True">
					<Trigger.ExitActions>
						<BeginStoryboard Storyboard="{StaticResource Storyboard_Copy1}" x:Name="Storyboard_Copy1_BeginStoryboard"/>
					</Trigger.ExitActions>
					<Trigger.EnterActions>
						<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
					</Trigger.EnterActions>
				</Trigger>
			</Style.Triggers>
		</Style>
		<ObjectDataProvider x:Key="SongBrowserDS" d:IsDataSource="True" ObjectType="{x:Type Tutorial:SongBrowser}"/>
		<DataTemplate x:Key="SubDirectoriesTemplate">
			<StackPanel>
				<TextBlock Text="{Binding Path=Name, Mode=OneWay}" FontWeight="{Binding Path=HasSong, Converter={StaticResource BooleanToBoldConverter}, Mode=Default}"/>
			</StackPanel>
		</DataTemplate>
		<Storyboard x:Key="OnMissed">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="2"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="2"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="23"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="16"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="SongFinished">
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="scroller" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.5"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="36"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="36"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="36"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="-4"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="-4"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="-4"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(TextElement.FontSize)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="24"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="24"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="24"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(ContentControl.Content)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Play new song"/>
				<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="Play new song"/>
				<DiscreteObjectKeyFrame KeyTime="00:00:01.5000000" Value="Play new song"/>
			</ObjectAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
				<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
				<SplineDoubleKeyFrame KeyTime="00:00:01.5000000" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00">
					<DiscreteObjectKeyFrame.Value>
						<Visibility>Collapsed</Visibility>
					</DiscreteObjectKeyFrame.Value>
				</DiscreteObjectKeyFrame>
				<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
			</ObjectAnimationUsingKeyFrames>
			<BooleanAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(UIElement.IsEnabled)">
				<DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="False"/>
				<DiscreteBooleanKeyFrame KeyTime="00:00:01" Value="True"/>
			</BooleanAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="ShowLoadList">
			<BooleanAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(UIElement.IsEnabled)">
				<DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="False"/>
			</BooleanAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="scroller" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="newSongButton" Storyboard.TargetProperty="(UIElement.Visibility)">
				<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Collapsed}"/>
			</ObjectAnimationUsingKeyFrames>
		</Storyboard>
	</Window.Resources>
	<Window.DataContext>
		<WpfHero:WHEngine />
	</Window.DataContext>
	<Window.Triggers>
		<EventTrigger RoutedEvent="FrameworkElement.Loaded">
			<BeginStoryboard Storyboard="{StaticResource ShowLoadList}"/>
		</EventTrigger>
		<EventTrigger RoutedEvent="TextBoxBase.TextChanged" SourceName="tbMissed">
			<BeginStoryboard Storyboard="{StaticResource OnMissed}" x:Name="OnMissed_BeginStoryboard"/>
		</EventTrigger>
	</Window.Triggers>
    <Grid>
        <ListBox Margin="10,88,0,24" x:Name="lbSongBrowser" Style="{DynamicResource SongBrowserStyle}" ItemsSource="{Binding Path=SubDirectories, Mode=Default, Source={StaticResource SongBrowserDS}}" ItemTemplate="{DynamicResource SubDirectoriesTemplate}" MouseDoubleClick="lbSongBrowser_MouseDoubleClick" KeyUp="lbSongBrowser_KeyUp" HorizontalAlignment="Left" Width="145" />
    	<StackPanel Margin="10,17,58,0" VerticalAlignment="Top" Height="54" Orientation="Horizontal">
    		<TextBox Text="Score" TextWrapping="Wrap" Margin="0,0,8,0"/>
    		<TextBox Text="{Binding Path=Score, Mode=Default}" TextWrapping="Wrap" Margin="0,0,8,0"/>
    		<TextBox Text="Missed" TextWrapping="Wrap" Margin="0,0,8,0"/>
    		<TextBox Text="{Binding Path=MissedGemCount, Mode=Default}" TextWrapping="Wrap" Margin="0,0,8,0" x:Name="tbMissed"/>
    		<TextBox Text="Multiplier" TextWrapping="Wrap" Margin="0,0,8,0"/>
    		<TextBox Text="{Binding Path=Multiplier, Mode=Default}" TextWrapping="Wrap" Margin="0,0,8,0"/>
    	</StackPanel>
    	<ToggleButton HorizontalAlignment="Left" Margin="185,97,0,0" VerticalAlignment="Top" Width="Auto" Height="30" Content="F1" IsChecked="{Binding Path=IsButton1Pressed, Mode=Default}"/>
    	<ToggleButton HorizontalAlignment="Left" Margin="185,148,0,0" VerticalAlignment="Top" Width="Auto" Height="32" Content="F2"  IsChecked="{Binding Path=IsButton2Pressed, Mode=Default}"/>
    	<ToggleButton HorizontalAlignment="Left" Margin="185,196,0,223" Width="Auto" Content="F3"  IsChecked="{Binding Path=IsButton3Pressed, Mode=Default}"/>
    	<ToggleButton HorizontalAlignment="Left" Margin="185,0,0,170" Width="Auto" Content="F4" VerticalAlignment="Bottom" Height="32"  IsChecked="{Binding Path=IsButton4Pressed, Mode=Default}"/>
    	<ToggleButton HorizontalAlignment="Left" Margin="185,0,0,121" Width="Auto" Content="F5" RenderTransformOrigin="0.59,2.375" VerticalAlignment="Bottom" Height="32"  IsChecked="{Binding Path=IsButton5Pressed, Mode=Default}"/>
    	<ToggleButton HorizontalAlignment="Left" Margin="185,0,0,71" Width="Auto" Content="Shift" RenderTransformOrigin="0.59,2.375" VerticalAlignment="Bottom" Height="32" IsChecked="{Binding Path=IsStrumKeyPressed, Mode=Default}"/>
    	<Tutorial:SongScroller Margin="229,97,8,71" x:Name="scroller" Opacity="1"/>
    	<TextBlock Margin="292,17,285,0" VerticalAlignment="Top" Height="37" Text="MISSED!" TextWrapping="Wrap" Opacity="0" x:Name="textBlock" RenderTransformOrigin="0.5,0.5">
    		<TextBlock.RenderTransform>
    			<TransformGroup>
    				<ScaleTransform ScaleX="1" ScaleY="1"/>
    				<SkewTransform AngleX="0" AngleY="0"/>
    				<RotateTransform Angle="0"/>
    				<TranslateTransform X="0" Y="0"/>
    			</TransformGroup>
    		</TextBlock.RenderTransform>
    	</TextBlock>
    	<Button Margin="299,167,89,214" Content="Button" x:Name="newSongButton" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed" Click="newSongButton_Click">
    		<Button.RenderTransform>
    			<TransformGroup>
    				<ScaleTransform ScaleX="1" ScaleY="1"/>
    				<SkewTransform AngleX="0" AngleY="0"/>
    				<RotateTransform Angle="0"/>
    				<TranslateTransform X="0" Y="0"/>
    			</TransformGroup>
    		</Button.RenderTransform>
    	</Button>
    </Grid>
</Window>
